import Vue from "vue";
import Router from "vue-router";
const _import = require("./_import_" + process.env.NODE_ENV);
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading
Vue.use(Router);

/* layout */
import Layout from "../views/layout/Layout";

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will no redirct in the levelbar
 * noDropdown : if `noDropdown:true` will has no submenu
 * meta : { role: ['admin'] }  will control the page role
 **/
export const constantRouterMap = [{
  path: "/login",
  component: _import("login/index"),
  hidden: true,
  meta: {
    role: [
      "admin",
      "zhdDC",
      "zhdMWKJ",
      "zhdFlh",
      "zhdJK",
      "zhdCYY",
      "zhdRM",
      "zhdXRXBB",
      "zhdSJFWB",
      "zhdCWB"
    ]
  }
},
{
  path: "/",
  component: Layout,
  redirect: "/pages/DataAnalysis",
  name: "首页",
  meta: {
    role: [
      "admin",
      "zhdMWKJ",
      "zhdDC",
      "zhdFlh",
      "zhdJK",
      "zhdCYY",
      "zhdRM",
      "zhdXZ",
      "zhdXRXBB",
      "zhdSJFWB",
      "zhdCWB"
    ]
  },
  hidden: true
},
{
  path: "/pages/DataAnalysis",
  icon: "zonghe",
  noDropdown: true,
  hidden: true,
  redirect: "/pages/DataAnalysis/indexMenu",
  component: Layout,
  meta: {
    role: [
      "admin",
      "zhdMWKJ",
      "zhdDC",
      "zhdFlh",
      "zhdCYY",
      "zhdJK",
      "zhdRM",
      "zhdXZ",
      "zhdXRXBB",
      "zhdSJFWB",
      "zhdCWB"
    ]
  },
  children: [{
    icon: "zonghe",
    path: "indexMenu",
    component: _import("pages/DataAnalysis/AnalysisHome/indexMenu"),
    name: "浩德数据",
    meta: {
      role: [
        "admin",
        "zhdMWKJ",
        "zhdDC",
        "zhdFlh",
        "zhdCYY",
        "zhdJK",
        "zhdRM",
        "zhdXZ",
        "zhdXRXBB",
        "zhdSJFWB",
        "zhdCWB"
      ]
    }
  }]
},
{
  path: "/pages/keyJob/allSale",
  component: Layout,
  name: "重点工作部署会",
  hidden: true,
  icon: "zonghe",
  meta: {
    role: [
      "admin",
      "zhdDC",
      "zhdMWKJ",
      "zhdDC",
      "zhdJK",
      "zhdRM",
      "zhdXZ",
      "admin",
      "zhdXRXBB",
      "zhdSJFWB",
      "zhdCWB"
    ]
  },
  children: [{
    path: "/pages/keyJob/allSale",
    component: _import("pages/keyJob/index"),
    redirect: "/pages/keyJob/allSale/quanyuanyingxiao",
    name: "全员营销",
    icon: "table",
    meta: {
      role: [
        "admin",
        "zhdDC",
        "zhdMWKJ",
        "zhdDC",
        "zhdFlh",
        "zhdJK",
        "zhdRM",
        "zhdXZ",
        "admin",
        "zhdXRXBB",
        "zhdSJFWB",
        "zhdCWB"
      ]
    },
    children: [{
      path: "quanyuanyingxiao",
      component: _import("pages/keyJob/allSale/quanyuanyingxiao/index"),
      name: "全员营销统计",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "quanyuanyingxiaoPM",
      component: _import("pages/keyJob/allSale/quanyuanyingxiaoPM/index"),
      name: "全员营销排名",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    }
    ]
  }]
}
];

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
});

export const asyncRouterMap = [
  //   {
  //   path: "/permission",
  //   component: Layout,
  //   noDropdown: true,
  //   redirect: "/permission/index",
  //   meta: {
  //     title: "权限",
  //     icon: "lock",
  //     roles: ["admin"] // you can set roles in root nav
  //   },
  //   children: [{
  //     path: "index",
  //     component: () =>
  //         import("@/views/permission/index"),
  //     name: "pagePermission",
  //     meta: {
  //       title: "权限",
  //       roles: ["admin"] // or you can only set roles in sub nav
  //     }
  //   }]
  // },
  {
    path: "/pages/DataAnalysis",
    icon: "zonghe",
    noDropdown: true,
    component: Layout,
    redirect: "/pages/DataAnalysis/indexMenu",
    meta: {
      role: ["admin", "zhdFlh"]
    },
    children: [{
      icon: "zonghe",
      path: "indexMenu",
      component: _import("pages/DataAnalysis/AnalysisHome/indexMenu"),
      name: "浩德数据"
    }]
  },
  {
    path: "/pages/keyJob/allSale",
    component: Layout,
    name: "重点工作部署会",
    icon: "zonghe",
    meta: {
      role: [
        "admin",
        "zhdDC",
        "zhdMWKJ",
        "zhdDC",
        "zhdJK",
        "zhdRM",
        "zhdXZ",
        "admin",
        "zhdXRXBB",
        "zhdSJFWB",
        "zhdCWB"
      ]
    },
    children: [{
      path: "quanyuanyingxiao",
      icon: "round",
      component: _import("pages/keyJob/allSale/quanyuanyingxiao/index"),
      name: "全员营销统计",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "partner",
      icon: "round",
      component: _import("pages/keyJob/allSale/partner/index"),
      hidden: true,
      name: "板块合伙人",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "quanyuanyingxiaoPM",
      icon: "round",
      component: _import("pages/keyJob/allSale/quanyuanyingxiaoPM/index"),
      name: "全员营销排名",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "jiandaotuan",
      icon: "round",
      component: _import("pages/keyJob/allSale/jiandaotuan/index"),
      hidden: true,
      name: "尖刀团排名",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "xingdongjihua",
      icon: "round",
      component: _import("pages/keyJob/allSale/xingdongjihua/index"),
      name: "行动计划完成情况",
      hidden: false,
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    }
    ]
  },
  {
    path: "/pages/bigData3/finance",
    component: Layout,
    name: "财务信息数据",
    icon: "zonghe",
    meta: {
      role: [
        "admin",
        "zhdDC",
        "zhdMWKJ",
        "zhdDC",
        "zhdJK",
        "zhdRM",
        "zhdXZ",
        "admin",
        "zhdXRXBB",
        "zhdSJFWB",
        "zhdCWB"
      ]
    },
    children: [{
      path: "profit",
      icon: "round",
      component: _import("pages/bigData3/finance/allReport/profit"),
      name: "利润表",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "balance",
      icon: "round",
      component: _import("pages/bigData3/finance/allReport/balance"),
      name: "资产负债表",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    },
    {
      path: "financial",
      icon: "round",
      component: _import("pages/bigData3/finance/financial"),
      name: "财务报表分析",
      meta: {
        role: [
          "admin",
          "zhdDC",
          "zhdMWKJ",
          "zhdDC",
          "zhdFlh",
          "zhdJK",
          "zhdRM",
          "zhdXZ",
          "admin",
          "zhdXRXBB",
          "zhdSJFWB",
          "zhdCWB"
        ]
      }
    }

    ]
  },
  {
    path: "/pages/newBigData",
    component: Layout,
    name: "数据中心2.0",
    icon: "zonghe",
    hidden: true,
    meta: {
      role: [
        "admin",
        "zhdDC",
        "zhdMWKJ",
        "zhdDC",
        "zhdJK",
        "zhdRM",
        "zhdXZ",
        "admin",
        "zhdXRXBB",
        "zhdSJFWB",
        "zhdCWB"
      ]
    },
    children: [{
      path: "flh",
      icon: "table",
      component: _import("pages/newBigData/flh/index"),
      name: "房联行分析",
      meta: {
        role: ["admin", "zhdXZ", "zhdDC"]
      }
    },
    {
      path: "propertiesAnalysis",
      icon: "table",
      hidden: true,
      component: _import("pages/newBigData/flh/propertiesAnalysis"),
      name: "房源统计",
      meta: {
        role: ["admin", "zhdXZ", "zhdDC"]
      }
    },
    {
      path: "passengerSourceAnalysis",
      icon: "table",
      hidden: true,
      component: _import("pages/newBigData/flh/passengerSourceAnalysis"),
      name: "客源统计",
      meta: {
        role: ["admin", "zhdXZ", "zhdDC"]
      }
    },
    {
      path: "transactionAnalysis",
      icon: "table",
      hidden: true,
      component: _import("pages/newBigData/flh/transactionAnalysis"),
      name: "成交分析",
      meta: {
        role: ["admin", "zhdXZ", "zhdDC"]
      }
    }
    ]
  },
  {
    path: "/pages/bigDatarl",
    component: Layout,
    redirect: "/pages/bigDatarl/rl",
    name: "人力资源数据",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdRl"]
    },
    children: [{
      path: "rl",
      icon: "round",
      component: _import("pages/bigData3/rl/index"),
      name: "人力资源数据中心",
      meta: {
        role: ["admin", "zhdRl"]
      }
    },
    {
      path: "rljx",
      icon: "round",
      component: _import("pages/bigData3/rljx/index"),
      name: "人力资源绩效管理",
      meta: {
        role: ["admin", "zhdRl"]
      }
    },
    {
      path: "flhDataBase",
      icon: "round",
      component: _import("pages/bigData3/rl/flhDataBase"),
      name: "房联行基础数据运算",
      meta: {
        role: ["admin", "zhdRl"]
      }
    }
    ]
  },
  {
    path: "/pages/bigDatadc",
    component: Layout,
    redirect: "/pages/bigDatadc/dc",
    name: "地产经营数据",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdDC"]
    },
    children: [{
      path: "dc",
      icon: "round",
      component: _import("pages/bigData3/dc/index"),
      name: "驾驶舱",
      meta: {
        role: ["admin", "zhdDC"]
      }
    }]
  },
  {
    path: "/pages/bigDataflh",
    component: Layout,
    redirect: "/pages/bigDataflh/flhCity",
    name: "房联行经营数据",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdFlh"]
    },
    children: [
      //   {
      //   path: "flhCity",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/index"),
      //   name: "驾驶舱",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      // {
      //   path: "cityAnalysis",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/cityAnalysis"),
      //   name: "城市数据",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      // {
      //   path: "areaAnalysis",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/areaAnalysis"),
      //   name: "区域数据",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      // {
      //   path: "storeAnalysis",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/storeAnalysis"),
      //   name: "门店数据",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      // {
      //   path: "transactionAnalysis",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/transactionAnalysis"),
      //   name: "绩效收入",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      // {
      //   path: "workloadAnalysis",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/workloadAnalysis"),
      //   name: "工作量分析",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      // {
      //   path: "operationAnalysis",
      //   icon: "round",
      //   component: _import("pages/bigData3/flh/operationAnalysis"),
      //   name: "运营数据分析",
      //   meta: {
      //     role: ["admin", "zhdFlh"]
      //   }
      // },
      {
        path: "industryData",
        icon: "round",
        component: _import("pages/bigData3/flh/industryData"),
        name: "行业数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      },
      {
        path: "operationLY",
        icon: "round",
        component: _import("pages/bigData3/flh/operationLY"),
        name: "洛阳运营数据",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      },
      {
        path: "developmentData",
        icon: "round",
        component: _import("pages/bigData3/flh/developmentData"),
        name: "业务发展规划",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      },
      {
        path: "flhDataPanel",
        icon: "round",
        component: _import("pages/bigData3/flh/new/newsIndex"),
        name: "房联行数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      }, {
        path: "newsWorkload",
        icon: "round",
        component: _import("pages/bigData3/flh/new/newsWorkload"),
        name: "工作量数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      }, {
        path: "newsTrading",
        icon: "round",
        component: _import("pages/bigData3/flh/new/newsTrading"),
        name: "交易数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      }, {
        path: "customerData",
        icon: "round",
        component: _import("pages/bigData3/flh/new/customerData"),
        name: "客源数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      }, {
        path: "housingData",
        icon: "round",
        component: _import("pages/bigData3/flh/new/housingData"),
        name: "房源数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      }, {
        path: "staffData",
        icon: "round",
        component: _import("pages/bigData3/flh/new/staffData"),
        name: "人员数据看板",
        meta: {
          role: ["admin", "zhdFlh"]
        }
      }
    ]
  },
  {
    path: "/pages/bigData3",
    component: Layout,
    redirect: "/pages/bigData3/gq",
    name: "钢圈经营数据",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdGQ"]
    },
    children: [{
      path: "indexOut",
      icon: "round",
      hidden: true,
      component: _import("pages/bigData3/gq/indexOut"),
      name: "驾驶舱（对外）",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "indexIn",
      icon: "round",
      component: _import("pages/bigData3/gq/indexIn"),
      name: "驾驶舱",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "sellAnalysis",
      icon: "round",
      component: _import("pages/bigData3/gq/sellAnalysis"),
      name: "运营分析",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "steelRingData",
      icon: "round",
      component: _import("pages/bigData3/gq/steelRingData"),
      name: "钢圈网DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "selfShops",
      icon: "round",
      component: _import("pages/bigData3/gq/selfShops"),
      name: "自营店铺DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "depotData",
      icon: "round",
      component: _import("pages/bigData3/gq/depotData"),
      name: "钢圈仓库DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "transportData",
      icon: "round",
      component: _import("pages/bigData3/gq/transportData"),
      name: "浩德智运DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    },
    {
      path: "supplyChainData",
      icon: "round",
      component: _import("pages/bigData3/gq/supplyChainData"),
      name: "供应链金融DashBoard",
      meta: {
        role: ["admin", "zhdGQ"]
      }
    }
    ]
  },
  // {
  //   path: "/pages/bigDataTest",
  //   component: Layout,
  //   redirect: "/pages/bigDataTest/gqTest",
  //   name: "钢圈经营数据（测试）",
  //   icon: "zonghe",
  //   meta: {
  //     role: ["admin", "zhdGQ"]
  //   },
  //   children: [{
  //     path: "indexOut",
  //     icon: "round",
  //     component: _import("pages/bigData3/gqTest/indexOut"),
  //     name: "驾驶舱（对外）",
  //     meta: {
  //       role: ["admin", "zhdGQ"]
  //     }
  //   },
  //   {
  //     path: "indexIn",
  //     icon: "round",
  //     component: _import("pages/bigData3/gqTest/indexIn"),
  //     name: "驾驶舱",
  //     meta: {
  //       role: ["admin", "zhdGQ"]
  //     }
  //   },
  //   {
  //     path: "sellAnalysis",
  //     icon: "round",
  //     component: _import("pages/bigData3/gqTest/sellAnalysis"),
  //     name: "运营分析",
  //     meta: {
  //       role: ["admin", "zhdGQ"]
  //     }
  //   }
  //   ]
  // },
  {
    path: "/pages/bossVersion",
    component: Layout,
    redirect: "/pages/bossVersion/financialSituation",
    name: "老板版本",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdCYY"]
    },
    children: [{
      path: "financialSituation",
      icon: "round",
      component: _import("pages/bossVersion/caiwu/financialSituation"),
      name: "财务情况",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    }]
  },
  {
    path: "/pages/bigDatacyy",
    component: Layout,
    redirect: "/pages/bigDatacyy/indexOut",
    name: "产业园经营数据",
    icon: "zonghe",
    meta: {
      role: ["admin", "zhdCYY"]
    },
    children: [{
      path: "indexOut",
      icon: "round",
      component: _import("pages/bigData3/cyy/indexOut"),
      name: "浩德速运经营数据",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "eCommerce",
      icon: "round",
      component: _import("pages/bigData3/cyy/eCommerce"),
      name: "自营电商经营数据",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "cloudWarehouse",
      icon: "round",
      component: _import("pages/bigData3/cyy/cloudWarehouse"),
      name: "云仓经营数据",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "selfQuotient",
      icon: "round",
      component: _import("pages/bigData3/cyy/selfQuotient"),
      name: "内贸电商数据看板",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "cloudStorehouse",
      icon: "round",
      component: _import("pages/bigData3/cyy/cloudStorehouse"),
      name: "云仓数据看板",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "bestrideAreaShop",
      icon: "round",
      component: _import("pages/bigData3/cyy/bestrideAreaShop"),
      name: "跨境电商数据看板",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "express",
      icon: "round",
      component: _import("pages/bigData3/cyy/express"),
      name: "浩德速运数据看板",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    },
    {
      path: "researchInstitute",
      icon: "round",
      component: _import("pages/bigData3/cyy/researchInstitute"),
      name: "电子商务产业园看板",
      meta: {
        role: ["admin", "zhdCYY"]
      }
    }
    ]
  },
  {
    path: "/errlog",
    component: Layout,
    redirect: "noredirect",
    name: "errlog",
    icon: "bug",
    hidden: true,
    noDropdown: true,
    children: [{
      path: "log",
      component: _import("errlog/index"),
      name: "错误日志"
    }]
  },
  {
    path: "*",
    hidden: true,
    component: _import("errorPage/404")
  }
];
